<!--
 * @Author: MrLee
 * @Date: 2024-08-23 23:46:53
 * @LastEditors: MrLee
 * @LastEditTime: 2024-08-24 00:05:27
 * @Description: 请填写简介
-->
<template>
  <view>
    <custom-navbar title="我看过" :autoBack="true" leftIconColor="#303133"/>
    <up-gap height="30rpx" />
    <JobList :job-list="res" />
  </view>
</template>
  <script lang="ts" setup>
import { userJobInteractionList } from '@/api/user';
import JobList from '@/pages/components/jobList/index.vue';
// import home06 from '@/static/images/tab/home-06.png';
// import home10 from '@/static/images/tab/home-10.png';
const home06 = 'https://yiliao.test03.qcw800.com/static/images/tab/home-06.png';
const home10 = 'https://yiliao.test03.qcw800.com/static/images/tab/home-10.png';

const res:any = reactive([]);
async function getJobInterationList() {
  let result = await userJobInteractionList({me_look: 1});
  console.log('我看过 res list:::', result);
  //vue3传递result的值到子组件JobList中的属性jobList中
  for (let i = 0; i < result.list.length; i++) {
    const r = result.list[i]
    let rr = {
      job_name: r.job.name,
      job_id: r.job.id,
      salary_min: r.job.salary_min,
      salary_max: r.job.salary_max,
      salary_count: r.job.salary_count,
      province: r.job.province.name,
      city: r.job.city.name,
      job_nature: r.job.nature,
      qualifications: '',
      highlights: r.job.highlights,
      company_id: r.job.company.id,
      company_logo: r.job.company.url_logo,
      company_name: r.job.company.name,
      company_type: r.job.company.type == 1 ? '民营': r.job.company.type == 2 ? '国企' : '合资',
      company_listed: r.job.company.listed == 1 ? '未上市': '上市',
      like: r.like,
      like_img: r.like == 1 ? home06 : home10,
      hr_avatar: r.job.user.avatar,
      hr_name: r.job.user.name,
      hr_duty: r.job.user.hr.duty.name,
      hr_id: r.job.user.id,
    }
    let qualifications = ''
    for (let j = 0; j < r.job.qualifications.length; j++) {
      qualifications += r.job.qualifications[j] + ' '
    }
    rr.qualifications = qualifications
    res.push(rr)
  }
}

onLoad((query: any) => {
  //query.status   1看过我
  console.log('回传status:::',query.status);
  if(query.status === '1'){
    getJobInterationList();
  }


});

</script>

